require('dotenv').config()
const express = require('express')
const app = express()
const cors = require('cors')

const logger = require('./utils/logger')
const launchMongodb = require('./db/db')

const unloadOrders = require('./business/unloadOrders')

app.use(cors())

app.get('/api/unload/orders', unloadOrders)

app.listen(process.env.PORT, async () => {
	logger(`HTTP сервер запущен и использует порт ${process.env.PORT}`)
	await launchMongodb()
})